from pysimm import system, lmps, forcefield
from pysimm.apps.random_walk import random_walk

def run(test=False):
    tip3p = forcefield.tip3p.Tip3p()
    water = system.read_pubchem_smiles('O')
    water.apply_forcefield(tip3p)
    molecule_list=[water]
    
    n_molecules=[100]
    
    s=system.replicate(molecule_list, n_molecules , density=1.0)
    s.write_lammps('longer_polymer.lmps')
    min_settings = {
        'name': 'fire_min',
        'min_style': 'fire',
        'print_to_screen': True
    }
    
    nvt_settings = {
        'name': 'nvt_md',
        'print_to_screen': True,
        'ensemble': 'nvt',
        'temperature': {
            'start': 300,
            'stop': 300
        },
        'new_v': True,
        'length': 10000
    }
    
    lmps.quick_min(s, **min_settings)
    lmps.quick_md(s, **nvt_settings)
    
    s.write_xyz('mixture.xyz')
    s.write_yaml('mixture.yaml')
    s.write_lammps('mixture.lmps')
    s.write_chemdoodle_json('mixture.json')
    
if __name__ == '__main__':
    run()